﻿using WorldMapBase.Tile.Pool;

namespace Yoozoo.Modules.Download
{
    public class PreAllocatedBufferPool : ObjectPool<PreAllocatedBuffer>
    {
        private int bufferSize;

        public PreAllocatedBufferPool(int capacity, int bufferSize = 1024 * 1024) : base(capacity)
        {
            this.bufferSize = bufferSize;
        }

        public PreAllocatedBufferPool(int capacity, bool enableAutoShrink, int idleMaxCount, int frameShrinkCount, float shrinkIntervalTime) : base(capacity, enableAutoShrink, idleMaxCount, frameShrinkCount, shrinkIntervalTime)
        {
        }

        protected override PreAllocatedBuffer ConstructItem()
        {
            return new PreAllocatedBuffer(bufferSize);
        }
    }
}
